home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-13 / thesrc10.zip / DEFAULT.C < prev    next >
C/C++ Source or Header  |  1992-08-11  |  19KB  |  562 lines

  1. /***********************************************************************/
  2. /* DEFAULT.C - Default settings and profile processing                 */
  3. /***********************************************************************/
  4. /*
  5.  * THE - The Hessling Editor. A text editor similar to VM/CMS xedit.
  6.  * Copyright (C) 1991,1992 Mark Hessling
  7.  *
  8.  * This program is free software; you can redistribute it and/or
  9.  * modify it under the terms of the GNU General Public License as
  10.  * published by the Free Software Foundation; either version 2 of
  11.  * the License, or any later version.
  12.  *
  13.  * This program is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16.  * General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU General Public License
  19.  * along with this program; if not, write to:
  20.  *
  21.  *    The Free Software Foundation, Inc.
  22.  *    675 Mass Ave,
  23.  *    Cambridge, MA 02139 USA.
  24.  *
  25.  *
  26.  * If you make modifications to this software that you feel increases
  27.  * it usefulness for the rest of the community, please email the
  28.  * changes, enhancements, bug fixes as well as any and all ideas to me.
  29.  * This software is going to be maintained and enhanced as deemed
  30.  * necessary by the community.
  31.  *
  32.  * Mark Hessling                     email: M.Hessling@itc.gu.edu.au
  33.  * 36 David Road                     Phone: +61 7 849 7731
  34.  * Holland Park                      Fax:   +61 7 875 7877
  35.  * QLD 4121
  36.  * Australia
  37.  */
  38. #include <stdio.h>
  39. #include <stdlib.h>
  40.  
  41. #include "the.h"
  42.  
  43. /*#define DEBUG 1*/
  44.  
  45. /*--------------------------- extern data -----------------------------*/
  46. extern WINDOW *foot;
  47. extern VIEW_DETAILS *vd_current,*vd_first;
  48. extern char current_screen;
  49. extern SCREEN_DETAILS screen[MAX_SCREENS];        /* screen structures */
  50. extern char display_screens;                      /* number of screens */
  51. extern bool horizontal;
  52. extern char current_file;                   /* pointer to current file */
  53. extern LINE *next_line,*curr_line;
  54. extern unsigned char *rec;
  55. extern unsigned char in_profile;    /* indicates if processing profile */
  56. extern char number_of_views;                        /* number of files */
  57. extern char number_of_files;                   /* number of open files */
  58.  
  59. /*--------------------------- global data -----------------------------*/
  60. extern unsigned char *profilename;
  61.  
  62.  unsigned char CMD_LINEx;
  63.  unsigned char ERROR_ROWx;
  64.  unsigned char TAB_ROWx;
  65.  unsigned char TAB_ONx;
  66.  unsigned char SCALE_ROWx;
  67.  unsigned char SCALE_ONx;
  68.  unsigned char PRE_ONx;
  69.  unsigned char PRE_LEFTx;
  70.  unsigned char CURRENT_ROW_POSx;
  71.  unsigned char STAYx;
  72.  unsigned char CASE_Ex;
  73.  unsigned char CASE_Lx;
  74.  unsigned char CASE_Cx;
  75.  unsigned char TABI_ONx;
  76.  unsigned char TABI_Nx;
  77.  unsigned char TABO_ONx;
  78.  unsigned char TABO_Nx;
  79.  unsigned char TABSx;
  80.  unsigned char CMDARROWSTABx;
  81.  unsigned char AUSx;
  82.  unsigned char EOLx;
  83.  unsigned short VER_STAx;
  84.  unsigned short VER_ENDx;
  85.  unsigned short VER_COLx;
  86.  unsigned short ZON_STAx;
  87.  unsigned short ZON_ENDx;
  88.  
  89. /***********************************************************************/
  90. #ifdef PROTO
  91. void set_defaults(void)
  92. #else
  93. void set_defaults()
  94. #endif
  95. /***********************************************************************/
  96. {
  97. /*--------------------------- local data ------------------------------*/
  98. /*--------------------------- processing ------------------------------*/
  99. #ifdef TRACE
  100.  trace_function("default.c: set_defaults");
  101. #endif
  102.  CMD_LINEx = 'B';
  103.  ERROR_ROWx = 1;
  104.  TAB_ROWx = 6;
  105.  TAB_ONx = FALSE;
  106.  SCALE_ROWx = 6;
  107.  SCALE_ONx = FALSE;
  108.  PRE_ONx = TRUE;
  109.  PRE_LEFTx = TRUE;
  110.  CURRENT_ROW_POSx = 0;
  111.  STAYx = ON;
  112.  CASE_Ex = CASE_MIXED;
  113.  CASE_Lx = CASE_IGNORE;
  114.  CASE_Cx = CASE_RESPECT;
  115.  
  116.  TABI_ONx = FALSE;
  117.  TABI_Nx = 8;
  118.  TABO_ONx = FALSE;
  119.  TABO_Nx = 8;
  120.  TABSx = 8;
  121.  CMDARROWSTABx = FALSE;
  122.  
  123.  VER_STAx = 1;
  124.  VER_ENDx = MAX_LINE_LENGTH;
  125.  VER_COLx = 1;
  126.  ZON_STAx = 1;
  127.  ZON_ENDx = MAX_INT;
  128.  
  129.  AUSx = 0;
  130. #ifdef UNIX
  131.  EOLx = EOLOUT_LF;
  132. #endif
  133. #if defined(DOS) || defined(OS2)
  134.  EOLx = EOLOUT_CRLF;
  135. #endif
  136. /*---------------------------------------------------------------------*/
  137. /* Set up the first dummy key definition.                              */
  138. /*---------------------------------------------------------------------*/
  139.  add_define("","","");
  140. #ifdef TRACE
  141.  trace_return();
  142. #endif
  143.  return;
  144. }
  145. /***********************************************************************/
  146. #ifdef PROTO
  147. void set_default_colours(void)
  148. #else
  149. void set_default_colours()
  150. #endif
  151. /***********************************************************************/
  152. {
  153. /*-------------------------- external data ----------------------------*/
  154.  
  155. /*--------------------------- local data ------------------------------*/
  156.  chtype dflt_colour[ATTR_MAX];
  157.  register int i;
  158. /*--------------------------- processing ------------------------------*/
  159. #ifdef TRACE
  160.  trace_function("default.c: set_default_colours");
  161. #endif
  162. /*---------------------------------------------------------------------*/
  163. /* Set up default colours.                                             */
  164. /*---------------------------------------------------------------------*/
  165. #ifdef COLOR_CURSES
  166.  if (has_colors() == TRUE)
  167.    {
  168.     init_pair(1,COLOR_WHITE,COLOR_BLUE);
  169.     init_pair(2,COLOR_WHITE,COLOR_BLUE);
  170.     init_pair(3,COLOR_BLUE,COLOR_WHITE);
  171.     init_pair(4,COLOR_RED,COLOR_WHITE);
  172.     init_pair(5,COLOR_BLACK,COLOR_CYAN);
  173.     init_pair(6,COLOR_BLUE,COLOR_WHITE);
  174.     init_pair(7,COLOR_RED,COLOR_WHITE);
  175.     init_pair(8,COLOR_BLACK,COLOR_CYAN);
  176.     init_pair(9,COLOR_BLACK,COLOR_CYAN);
  177.     init_pair(10,COLOR_RED,COLOR_WHITE);
  178.     init_pair(11,COLOR_RED,COLOR_WHITE);
  179.     init_pair(12,COLOR_WHITE,COLOR_BLUE);
  180.     init_pair(13,COLOR_WHITE,COLOR_BLUE);
  181.     init_pair(14,COLOR_RED,COLOR_WHITE);
  182.     init_pair(15,COLOR_RED,COLOR_WHITE);
  183.     init_pair(16,COLOR_BLUE,COLOR_WHITE);
  184.     init_pair(17,COLOR_RED,COLOR_WHITE);
  185.     for (i=0;i<ATTR_MAX;i++)
  186.         dflt_colour[i] = COLOR_PAIR(i+1);
  187.     dflt_colour[ATTR_CURLINE] |= A_BOLD;
  188.     dflt_colour[ATTR_TOFEOF] |= A_BOLD;
  189.     dflt_colour[ATTR_CTOFEOF] |= A_BOLD;
  190.     for (i=0;i<ATTR_MAX;i++)
  191.       if (colour[i])            /* a colour has been set up in profile */
  192.          set_colour(i,save_fg[i],save_bg[i],save_mod[i]);
  193.       else
  194.          colour[i] = dflt_colour[i];
  195.    }
  196.  else
  197.    {
  198.     dflt_colour[ATTR_FILEAREA] = A_NORMAL;           /* main window text lines */
  199.     dflt_colour[ATTR_CURLINE]  = A_BOLD;                       /* current line */
  200.     dflt_colour[ATTR_BLOCK]    = A_REVERSE;           /* text in markded block */
  201.     dflt_colour[ATTR_CBLOCK]   = A_BOLD | A_REVERSE;
  202.                                        /* current line if in marked block */
  203.     dflt_colour[ATTR_CMDLINE]  = A_BOLD;                       /* command line */
  204.     dflt_colour[ATTR_IDLINE]   = A_REVERSE;                    /* id line (top)*/
  205.     dflt_colour[ATTR_MSGLINE]  = A_BLINK;                      /* message line */
  206.     dflt_colour[ATTR_ARROW]    = A_BOLD;                       /* arrow prompt */
  207.     dflt_colour[ATTR_PREFIX]   = A_BOLD;                        /* prefix area */
  208.     dflt_colour[ATTR_PENDING]  = A_BOLD;            /* pending prefix commands */
  209.     dflt_colour[ATTR_SCALE]    = A_BOLD;                         /* scale line */
  210.     dflt_colour[ATTR_TOFEOF]   = A_BOLD;                      /* tof eof lines */
  211.     dflt_colour[ATTR_CTOFEOF]  = A_BOLD;     /* current line if on t/eof lines */
  212.     dflt_colour[ATTR_TABLINE]  = A_BOLD;                           /* tab line */
  213.     dflt_colour[ATTR_SHADOW]   = A_BOLD;                       /* shadow lines */
  214.     dflt_colour[ATTR_STATAREA] = A_REVERSE;             /* status line (bottom)*/
  215.     dflt_colour[ATTR_DIVIDER]  = A_BOLD;                            /* divider */
  216.     for (i=0;i<ATTR_MAX;i++)
  217.       if (colour[i])            /* a colour has been set up in profile */
  218.          set_colour(i,save_fg[i],save_bg[i],save_mod[i]);
  219.       else
  220.          colour[i] = dflt_colour[i];
  221.    }
  222. #else
  223.  dflt_colour[ATTR_FILEAREA] = A_NORMAL;           /* main window text lines */
  224.  dflt_colour[ATTR_CURLINE]  = A_BOLD;                       /* current line */
  225.  dflt_colour[ATTR_BLOCK]    = A_REVERSE;           /* text in markded block */
  226.  dflt_colour[ATTR_CBLOCK]   = A_BOLD | A_REVERSE;
  227.                                     /* current line if in marked block */
  228.  dflt_colour[ATTR_CMDLINE]  = A_BOLD;                       /* command line */
  229.  dflt_colour[ATTR_IDLINE]   = A_REVERSE;                    /* id line (top)*/
  230.  dflt_colour[ATTR_MSGLINE]  = A_BLINK;                      /* message line */
  231.  dflt_colour[ATTR_ARROW]    = A_BOLD;                       /* arrow prompt */
  232.  dflt_colour[ATTR_PREFIX]   = A_BOLD;                        /* prefix area */
  233.  dflt_colour[ATTR_PENDING]  = A_BOLD;            /* pending prefix commands */
  234.  dflt_colour[ATTR_SCALE]    = A_BOLD;                         /* scale line */
  235.  dflt_colour[ATTR_TOFEOF]   = A_BOLD;                      /* tof eof lines */
  236.  dflt_colour[ATTR_CTOFEOF]  = A_BOLD;     /* current line if on t/eof lines */
  237.  dflt_colour[ATTR_TABLINE]  = A_BOLD;                           /* tab line */
  238.  dflt_colour[ATTR_SHADOW]   = A_BOLD;                       /* shadow lines */
  239.  dflt_colour[ATTR_STATAREA] = A_REVERSE;             /* status line (bottom)*/
  240.  dflt_colour[ATTR_DIVIDER]  = A_BOLD;                            /* divider */
  241.  for (i=0;i<ATTR_MAX;i++)
  242.       if (colour[i])            /* a colour has been set up in profile */
  243.          set_colour(i,save_fg[i],save_bg[i],save_mod[i]);
  244.       else
  245.          colour[i] = dflt_colour[i];
  246. #endif
  247.  
  248. #ifdef TRACE
  249.  trace_return();
  250. #endif
  251.  return;
  252. }
  253. /***********************************************************************/
  254. #ifdef PROTO
  255. short get_profile(unsigned char *prf)
  256. #else
  257. short get_profile(prf)
  258. unsigned char *prf;
  259. #endif
  260. /***********************************************************************/
  261. {
  262. /*------------------------- external data -----------------------------*/
  263. extern unsigned char profile_pathname[80];
  264. /*--------------------------- local data ------------------------------*/
  265.  FILE *fp;
  266.  int ch;
  267.  register int i;
  268. /* unsigned char temp_profile[100];*/
  269.  unsigned char *profile_ptr;
  270.  short rc=OK;
  271. /*--------------------------- processing ------------------------------*/
  272. #ifdef TRACE
  273.  trace_function("default.c: get_profile");
  274. #endif
  275.  if (strcmp(prf,"") == 0)
  276.    {
  277.     if ((profile_ptr = (unsigned char *)getenv("THE")) == NULL)
  278.       {
  279.        if (file_exists(profile_pathname))
  280.           profile_ptr = profile_pathname;
  281.        else
  282.          {
  283. #ifdef TRACE
  284.           trace_return();
  285. #endif
  286.           return(rc);
  287.          }
  288.       }
  289.    }
  290.  else
  291.     profile_ptr = prf;
  292.  
  293.  if ((fp = fopen(profile_ptr,"r")) == NULL)
  294.    {
  295. #ifdef TRACE
  296.     trace_return();
  297. #endif
  298.     return(rc);
  299.    }
  300.  memset(rec,' ',MAX_LINE_LENGTH);
  301.  i = 0;
  302.  while(1)
  303.   {
  304.    ch = fgetc(fp);
  305.    if (feof(fp))
  306.       break;
  307.    if (ch == '\n')
  308.      {
  309.       rec[i] = '\0';
  310.       rc = command_line(rec);
  311.       if (rc == QUIT && number_of_views == 0)
  312.          break;
  313.       i = 0;
  314.       memset(rec,' ',MAX_LINE_LENGTH);
  315.       continue;
  316.      }
  317.    if (ch == '\r')
  318.      {
  319.       rec[i] = ch;
  320.       i++;
  321.       ch = fgetc(fp);
  322.       if (feof(fp))
  323.          break;
  324.       if (ch == '\n')
  325.         {
  326.          --i;
  327.          rec[i] = '\0';
  328.          rc = command_line(rec);
  329.          if (rc == QUIT && number_of_views == 0)
  330.             break;
  331.          i = 0;
  332.          memset(rec,' ',MAX_LINE_LENGTH);
  333.          continue;
  334.         }
  335.      }
  336.    rec[i] = ch;
  337.    i++;
  338.   }
  339.  fclose(fp);
  340. #ifdef TRACE
  341.  trace_return();
  342. #endif
  343.  return(rc);
  344. }
  345. /***********************************************************************/
  346. #ifdef PROTO
  347. short defaults_for_first_file(void)
  348. #else
  349. short defaults_for_first_file()
  350. #endif
  351. /***********************************************************************/
  352. {
  353. /*--------------------------- local data ------------------------------*/
  354.  register int i;
  355. /*--------------------------- processing ------------------------------*/
  356. #ifdef TRACE
  357.  trace_function("default.c: defaults_for_first_file");
  358. #endif
  359. /*---------------------------------------------------------------------*/
  360. /* Add to view linked list.                                            */
  361. /*---------------------------------------------------------------------*/
  362.  if ((CURRENT_VIEW = vll_add(vd_first,vd_current,sizeof(VIEW_DETAILS)))
  363.                    == (VIEW_DETAILS *)NULL)
  364.    {
  365. #ifdef TRACE
  366.     trace_return();
  367. #endif
  368.     return(ERROR);
  369.    }
  370.  if (vd_first == (VIEW_DETAILS *)NULL)
  371.     vd_first = CURRENT_VIEW;
  372.  
  373.  CURRENT_VIEW->current_row = 6;
  374.  CURRENT_VIEW->cmd_line = CMD_LINEx;
  375.  CURRENT_VIEW->error_row = ERROR_ROWx;
  376.  CURRENT_VIEW->tab_row = TAB_ROWx;
  377.  CURRENT_VIEW->tab_on = TAB_ONx;
  378.  CURRENT_VIEW->scale_row = SCALE_ROWx;
  379.  CURRENT_VIEW->scale_on = SCALE_ONx;
  380.  CURRENT_VIEW->focus_line = CURRENT_ROW_POSx;
  381.  CURRENT_VIEW->current_line = CURRENT_ROW_POSx;
  382.  CURRENT_VIEW->stay = STAYx;
  383.  CURRENT_VIEW->tabs = TABSx;
  384.  CURRENT_VIEW->case_enter = CASE_Ex;
  385.  CURRENT_VIEW->case_locate = CASE_Lx;
  386.  CURRENT_VIEW->case_change = CASE_Cx;
  387.  CURRENT_VIEW->prefix_on = PRE_ONx;
  388.  CURRENT_VIEW->prefix_left = PRE_LEFTx;
  389.  CURRENT_VIEW->verify_start = VER_STAx;
  390.  CURRENT_VIEW->verify_col = VER_COLx;
  391.  CURRENT_VIEW->verify_end = VER_ENDx;
  392.  CURRENT_VIEW->zone_start = ZON_STAx;
  393.  CURRENT_VIEW->zone_end = ZON_ENDx;
  394.  CURRENT_VIEW->mark_start_line = (-1L);
  395.  CURRENT_VIEW->mark_end_line = (-1L);
  396.  for (i=0;i<VIEW_WINDOWS;i++)
  397.      CURRENT_VIEW->win[i] = (WINDOW *)NULL;
  398.  
  399.  CURRENT_FILE = (FILE_DETAILS *)NULL;
  400.  
  401.  CURRENT_SCREEN.screen_view = CURRENT_VIEW;
  402.  
  403.  number_of_views++;
  404.  
  405. #ifdef TRACE
  406.  trace_return();
  407. #endif
  408.  return(OK);
  409. }
  410. /***********************************************************************/
  411. #ifdef PROTO
  412. short defaults_for_other_files(void)
  413. #else
  414. short defaults_for_other_files()
  415. #endif
  416. /***********************************************************************/
  417. {
  418. /*--------------------------- local data ------------------------------*/
  419.  register int i;
  420. /*--------------------------- processing ------------------------------*/
  421. #ifdef TRACE
  422.  trace_function("default.c: defaults_for_other_files");
  423. #endif
  424.  if ((CURRENT_VIEW = vll_add(vd_first,vd_current,sizeof(VIEW_DETAILS)))
  425.                    == (VIEW_DETAILS *)NULL)
  426.    {
  427. #ifdef TRACE
  428.     trace_return();
  429. #endif
  430.     return(ERROR);
  431.    }
  432.  if (vd_first == (VIEW_DETAILS *)NULL)
  433.     vd_first = CURRENT_VIEW;
  434.  
  435.  CURRENT_VIEW->command_row =     PREVIOUS_VIEW->command_row;
  436.  CURRENT_VIEW->cmd_line =        PREVIOUS_VIEW->cmd_line;
  437.  CURRENT_VIEW->error_row =       PREVIOUS_VIEW->error_row;
  438.  CURRENT_VIEW->tab_row =         PREVIOUS_VIEW->tab_row;
  439.  CURRENT_VIEW->tab_on =          PREVIOUS_VIEW->tab_on;
  440.  CURRENT_VIEW->scale_row =       PREVIOUS_VIEW->scale_row;
  441.  CURRENT_VIEW->scale_on =        PREVIOUS_VIEW->scale_on;
  442.  CURRENT_VIEW->current_row =     PREVIOUS_VIEW->current_row;
  443.  CURRENT_VIEW->current_line =    CURRENT_ROW_POSx;
  444.  CURRENT_VIEW->focus_line =      CURRENT_ROW_POSx;
  445.  CURRENT_VIEW->tabs =            TABSx;
  446.  CURRENT_VIEW->stay =            STAYx;
  447.  CURRENT_VIEW->case_enter =      CASE_Ex;
  448.  CURRENT_VIEW->case_locate =     CASE_Lx;
  449.  CURRENT_VIEW->case_change =     CASE_Cx;
  450.  CURRENT_VIEW->prefix_on =       PREVIOUS_VIEW->prefix_on;
  451.  CURRENT_VIEW->prefix_left =     PREVIOUS_VIEW->prefix_left;
  452.  CURRENT_VIEW->verify_start =    VER_STAx;
  453.  CURRENT_VIEW->verify_col =      VER_COLx;
  454.  CURRENT_VIEW->verify_end =      VER_ENDx;
  455.  CURRENT_VIEW->zone_start =      ZON_STAx;
  456.  CURRENT_VIEW->zone_end =        ZON_ENDx;
  457.  CURRENT_VIEW->mark_start_line = (-1L);
  458.  CURRENT_VIEW->mark_end_line =   (-1L);
  459.  
  460.  for (i=0;i<VIEW_WINDOWS;i++)
  461.      CURRENT_VIEW->win[i] = (WINDOW *)NULL;
  462.  
  463.  CURRENT_FILE = (FILE_DETAILS *)NULL;
  464.  
  465.  CURRENT_SCREEN.screen_view = CURRENT_VIEW;
  466.  
  467.  number_of_views++;
  468.  
  469. #ifdef TRACE
  470.  trace_return();
  471. #endif
  472.  return(OK);
  473. }
  474. /***********************************************************************/
  475. #ifdef PROTO
  476. short default_file_attributes(void)
  477. #else
  478. short default_file_attributes()
  479. #endif
  480. /***********************************************************************/
  481. {
  482. /*--------------------------- local data ------------------------------*/
  483. /*--------------------------- processing ------------------------------*/
  484. #ifdef TRACE
  485.  trace_function("default.c: default_file_attributes");
  486. #endif
  487.  
  488.  CURRENT_FILE->fmode =           FMODE;
  489.  CURRENT_FILE->file_views =      1;
  490.  CURRENT_FILE->first_line  =     NULL;
  491.  CURRENT_FILE->autosave_alt =    0;
  492.  CURRENT_FILE->autosave =        AUSx;
  493.  CURRENT_FILE->save_alt =        0;
  494.  CURRENT_FILE->eolout =          EOLx;
  495.  CURRENT_FILE->tabsout_on =      TABO_ONx;
  496.  CURRENT_FILE->tabsout_num =     TABO_Nx;
  497.  
  498.  CURRENT_FILE->fname =           (unsigned char *)NULL;
  499.  CURRENT_FILE->fpath =           (unsigned char *)NULL;
  500.  
  501. #ifdef TRACE
  502.  trace_return();
  503. #endif
  504.  return(OK);
  505. }
  506. /***********************************************************************/
  507. #ifdef PROTO
  508. void set_screen_defaults(void)
  509. #else
  510. void set_screen_defaults()
  511. #endif
  512. /***********************************************************************/
  513. {
  514. /*--------------------------- local data ------------------------------*/
  515. /*--------------------------- processing ------------------------------*/
  516. #ifdef TRACE
  517.  trace_function("default.c: set_screen_defaults");
  518. #endif
  519.  
  520.  CURRENT_SCREEN.origin_x =         0;
  521.  CURRENT_SCREEN.origin_y =         0;
  522.  if (horizontal)
  523.    {
  524.     CURRENT_SCREEN.screen_rows =   (LINES-1) / display_screens;
  525.     CURRENT_SCREEN.screen_cols =   COLS;
  526.    }
  527.  else
  528.    {
  529.     CURRENT_SCREEN.screen_rows =   (LINES-1);
  530.     CURRENT_SCREEN.screen_cols =   (COLS / display_screens)-((display_screens == 1) ? 0 : 1); /**/
  531.    }
  532.  if (display_screens == 1)
  533.    {
  534.     OTHER_SCREEN.origin_x =        0;
  535.     OTHER_SCREEN.origin_y =        0;
  536.     OTHER_SCREEN.screen_rows =     (LINES-1) / display_screens;
  537.     OTHER_SCREEN.screen_cols =     COLS;
  538.    }
  539.  else
  540.    {
  541.     if (horizontal)
  542.       {
  543.        OTHER_SCREEN.origin_x =     0;
  544.        OTHER_SCREEN.origin_y =     CURRENT_SCREEN.screen_rows;
  545.        OTHER_SCREEN.screen_rows =  (LINES-1) - ((LINES-1) / display_screens);
  546.        OTHER_SCREEN.screen_cols =  COLS;
  547.       }
  548.     else
  549.       {
  550.        OTHER_SCREEN.origin_x =     CURRENT_SCREEN.screen_cols+((display_screens == 1) ? 0 : 2); /**/
  551.        OTHER_SCREEN.origin_y =     0;;
  552.        OTHER_SCREEN.screen_rows =  (LINES-1);
  553.        OTHER_SCREEN.screen_cols =  COLS - CURRENT_SCREEN.screen_cols-((display_screens == 1) ? 0 : 2);/**/
  554.       }
  555.    }
  556.  
  557. #ifdef TRACE
  558.  trace_return();
  559. #endif
  560.  return;
  561. }
  562.